package com.turing.post.report.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.turing.post.util.PCPSUtil;


@SuppressWarnings("serial")
@Entity
@Table(name = "MerchantPastIncomeDetail")
@IdClass(MerchantPastIncomeDetail.class)
public class MerchantPastIncomeDetail implements Serializable {
	
	public MerchantPastIncomeDetail() {
		super();
	}
	
	
	String MerchantNo; //商户NO
	String IssueCompanyNo;//发卡商NO
	Date TranDate;//	帐务日期
	BigInteger FeePolicyId;//	手续费策略ID
	String SaleBranchNo;//	销售机构
	Date OrigTranDate;//	追溯日期
	BigInteger MIncomeBranchId;//	M收益机构ID
	BigInteger SIncomeBranchId;//	S收益机构ID
	Long OrigConsume;//	原消费
	Long OrigDeposit;//	原充值
	Integer OrigSettRatio;//	原结算比率
	Long OrigSIncome;//	原S收入合计
	Long OrigMIncome;//	原M收入合计
	Integer SettRatio;//	新结算比率
	Long SIncome;//	新S收入
	Long MIncome;//	新M收入
	Long SIncomeDiff;//	新S收入差值
	Long MIncomeDiff;//	新M收入差值
	
	@Id
	@Column(name = "MERCHANTNO", nullable = false)
	public String getMerchantNo() {
		return MerchantNo;
	}
	public void setMerchantNo(String merchantNo) {
		MerchantNo = merchantNo;
	}
	
	
	@Column(name = "ISSUECOMPANYNO", nullable = false)
	public String getIssueCompanyNo() {
		return IssueCompanyNo;
	}
	public void setIssueCompanyNo(String issueCompanyNo) {
		IssueCompanyNo = issueCompanyNo;
	}
	
	@Id
	@Column(name = "TRANDATE", nullable = false)
	public Date getTranDate() {
		return TranDate;
	}
	public void setTranDate(Date tranDate) {
		TranDate = tranDate;
	}
	
	@Id
	@Column(name = "FEEPOLICYID", nullable = false)
	public BigInteger getFeePolicyId() {
		return FeePolicyId;
	}
	public void setFeePolicyId(BigInteger feePolicyId) {
		FeePolicyId = feePolicyId;
	}
	
	@Id
	@Column(name = "SALEBRANCHNO", nullable = false)
	public String getSaleBranchNo() {
		return SaleBranchNo;
	}
	public void setSaleBranchNo(String saleBranchNo) {
		SaleBranchNo = saleBranchNo;
	}
	
	@Id
	@Column(name = "ORIGTRANDATE", nullable = false)
	public Date getOrigTranDate() {
		return OrigTranDate;
	}
	public void setOrigTranDate(Date origTranDate) {
		OrigTranDate = origTranDate;
	}
	
	@Column(name = "MINCOMEBRANCHID", nullable = false)
	public BigInteger getMIncomeBranchId() {
		return MIncomeBranchId;
	}
	public void setMIncomeBranchId(BigInteger incomeBranchId) {
		MIncomeBranchId = incomeBranchId;
	}
	
	@Column(name = "SINCOMEBRANCHID", nullable = false)
	public BigInteger getSIncomeBranchId() {
		return SIncomeBranchId;
	}
	public void setSIncomeBranchId(BigInteger incomeBranchId) {
		SIncomeBranchId = incomeBranchId;
	}
	
	@Column(name = "ORIGCONSUME", nullable = false)
	public Long getOrigConsume() {
		return OrigConsume;
	}
	public void setOrigConsume(Long origConsume) {
		OrigConsume = origConsume;
	}
	
	@Column(name = "ORIGDEPOSIT", nullable = false)
	public Long getOrigDeposit() {
		return OrigDeposit;
	}
	public void setOrigDeposit(Long origDeposit) {
		OrigDeposit = origDeposit;
	}
	
	@Column(name = "ORIGSETTRATIO", nullable = false)
	public Integer getOrigSettRatio() {
		return OrigSettRatio;
	}
	public void setOrigSettRatio(Integer origSettRatio) {
		OrigSettRatio = origSettRatio;
	}
	
	@Column(name = "ORIGSINCOME", nullable = false)
	public Long getOrigSIncome() {
		return OrigSIncome;
	}
	public void setOrigSIncome(Long origSIncome) {
		OrigSIncome = origSIncome;
	}
	
	@Column(name = "ORIGMINCOME", nullable = false)
	public Long getOrigMIncome() {
		return OrigMIncome;
	}
	public void setOrigMIncome(Long origMIncome) {
		OrigMIncome = origMIncome;
	}
	
	@Column(name = "SETTRATIO", nullable = false)
	public Integer getSettRatio() {
		return SettRatio;
	}
	public void setSettRatio(Integer settRatio) {
		SettRatio = settRatio;
	}
	
	@Column(name = "SINCOME", nullable = false)
	public Long getSIncome() {
		return SIncome;
	}
	public void setSIncome(Long income) {
		SIncome = income;
	}
	
	@Column(name = "MINCOME", nullable = false)
	public Long getMIncome() {
		return MIncome;
	}
	public void setMIncome(Long income) {
		MIncome = income;
	}
	
	@Column(name = "SINCOMEDIFF", nullable = false)
	public Long getSIncomeDiff() {
		return SIncomeDiff;
	}
	public void setSIncomeDiff(Long incomeDiff) {
		SIncomeDiff = incomeDiff;
	}
	
	@Column(name = "MINCOMEDIFF", nullable = false)
	public Long getMIncomeDiff() {
		return MIncomeDiff;
	}
	public void setMIncomeDiff(Long incomeDiff) {
		MIncomeDiff = incomeDiff;
	}
	
	@Override
	public int hashCode() {
		return PCPSUtil.getObjectListHashCode(new Object[] {
				getFeePolicyId(), getMerchantNo(), getTranDate(),getSaleBranchNo(),getOrigTranDate() });
	}

	@Override
	public boolean equals(Object obj) {
		if ((this == obj))
			return true;
		if ((obj == null))
			return false;
		if (!(obj instanceof MerchantDaySettlement))
			return false;
		MerchantPastIncomeDetail other = (MerchantPastIncomeDetail) obj;

		if (!PCPSUtil.compareObject(this.getFeePolicyId(), other
				.getFeePolicyId()))
			return false;

		if (!PCPSUtil
				.compareObject(this.getMerchantNo(), other.getMerchantNo()))
			return false;
		if (!PCPSUtil
				.compareObject(this.getTranDate(), other.getTranDate()))
			return false;
		if (!PCPSUtil
				.compareObject(this.getSaleBranchNo(), other.getSaleBranchNo()))
			return false;

		return PCPSUtil.compareObject(this.getOrigTranDate(), other.getOrigTranDate());
	}
	

}
